home *** CD-ROM | disk | FTP | other *** search
- /*
- ***********************************************************************
- *
- * Elevation Map
- *
- * A representation of a surface in space z=f(x,y) to render in 3D view
- *
- * The present ElevationMap class specifies the function z=f(x,y) using
- * a pixel matrix of an IMAGE. The (j,i)-pixel of the IMAGE corresponds to
- * a f(x,y) point of the map; the first argument, j, being the pixel
- * matrix' row index, refers to y; the second argument, i, a column index,
- * corresponds to x coordinate of the map. The value of this pixel is an
- * "elevation code", which is related to a map true elevation z via the
- * following formula
- * z = map(j,i) < z_cut_off ? 0 : (map(i,j)*elevation_factor)>>9;
- * This formula can scale the pixel values both up and down.
- *
- * Moreover, each "elevation code" is associated with a corresponding color via a
- * private colormap, clu_table. We assume that this colormap is arranged in some
- * order to allow "interpolation". That is, the color for the entry k should be in
- * a sense "in-between" the colors for entries k-1 and k+1.
- *
- * See view_3d.cc for more detail as to how it is all used.
- *
- * $Id$
- *
- ***********************************************************************
- */
-
- #pragma once
-
- #include "image.h"
- #include "window.h"
-
- class ElevationMap : public IMAGE
- {
- CLUTable clu_table;
- enum { default_clut_id = 128 };
- int z_cutoff, elevation_factor; // Coefficients to determine elevation z from
- // the map's "elevation code" (pixel value)
-
- ElevationMap(const ElevationMap&); // Disallow assignments/cloning
- void operator = (const ElevationMap&); // (at present)
-
- public:
- ElevationMap(const int order); // Make a default elevation map of
- // 2^order X 2^order size
-
- const CLUTable& q_clut(void) const { return clu_table; }
- int q_z_cutoff(void) const { return z_cutoff; }
- int q_elev_scale(void) const { return elevation_factor; }
-
- void load(const FSSpec& file_spec); // Load the map (and possibly clu_table)
- // from a given (PGM) file
- void dump(const char title[]="") const; // Tell me about this ElevationMap...
- };
-
-